package com.three.storemanage.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.three.core.entity.FrontUser;
import com.three.core.entity.StoreEvaluate;
import com.three.core.vo.R;
import com.three.storemanage.service.EvaluateService;
import com.three.storemanage.vo.EvaluateVo;
import com.three.storemanage.vo.SearchForm;
import com.three.storemanage.vo.StoreEvaluateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @FileName: EvaluateController
 * @Description:
 * @Author: GYX
 * @CreateTime: 2025/3/13 14:22
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("/store/evaluate")
public class EvaluateController {

    @Autowired
    private EvaluateService evaluateService;

    @PostMapping("/selectEvaluate")
    public R<Page<EvaluateVo>> findEvaluateByCondition(@RequestBody SearchForm searchForm) {
        return evaluateService.findEvaluateByCondition(searchForm);
    }

    @PostMapping("/selectAllCustomer")
    public R<List<FrontUser>> queryAll() {
        return evaluateService.queryAll();
    }

    @GetMapping("/deleteByEvaluateId")
    public R deleteEvaluate(Integer evaluateId) {
        return evaluateService.deleteEvaluate(evaluateId);
    }

    @PostMapping("/insertStoreEvaluate")
    public R addEvaluate(@RequestBody StoreEvaluate storeEvaluate) {
        return evaluateService.addEvaluate(storeEvaluate);
    }

    @PostMapping("/updateStoreEvaluate")
    public R updateEvaluate(@RequestBody StoreEvaluate storeEvaluate) {
        return evaluateService.updateEvaluate(storeEvaluate);
    }

    @PostMapping("/selectEvaluateByStoreName")
    public R<StoreEvaluateVo> selectEvaluateByStoreName(String storeName) {
        return evaluateService.selectEvaluateByStoreName(storeName);
    }

    @PostMapping("/selectEvaluateByStoreId")
    public R<List<StoreEvaluate>> selectEvaluateByStoreId(Integer storeId) {
        return evaluateService.selectEvaluateByStoreId(storeId);
    }
}
